/*************************************************************************
> File Name: pointadd.c
> Author: icebear
> Mail: 3322366195@qq.com
> Created Time: 2023-07-29 10:25:51
> Description: 指针自增
************************************************************************/

#include <stdio.h>

int main(int argc, char const *argv[])
{
    int arr[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
    int *p = arr;
    printf("*p = arr\n");
    printf("*p = %d\n", *p);
    printf("*p++ = %d\n", *p++);
    for (int i = 0; i < 10; i++)
    {
        printf("%-3d", arr[i]);
    }
    p = arr;
    printf("\n*p = arr\n");
    printf("*p = %d\n", *p);
    printf("*++p = %d\n", *++p);
    for (int i = 0; i < 10; i++)
    {
        printf("%-3d", arr[i]);
    }
    p = arr;
    printf("\np = arr\n");
    printf("(*++p) = %d\n", (*++p));
    for (int i = 0; i < 10; i++)
    {
        printf("%-3d", arr[i]);
    }
    p = arr;
    printf("\np = arr\n");
    printf("++(*++p) = %d\n", ++(*++p));
    for (int i = 0; i < 10; i++)
    {
        printf("%-3d", arr[i]);
    }
    arr[1] = 2;
    p = arr;
    printf("\np = arr\n");
    printf("++*++p = %d\n", ++*++p);
    for (int i = 0; i < 10; i++)
    {
        printf("%-3d", arr[i]);
    }

    arr[1] = 2;
    p = arr;
    printf("\np = arr\n");
    printf("*++p++ = %d\n", (*++p)++);
    for (int i = 0; i < 10; i++)
    {
        printf("%-3d", arr[i]);
    }

    return 0;
}
